import Vue from 'vue'
import Vuex, { Store } from 'vuex'
import createPersistedState from "vuex-persistedstate";

Vue.use(Vuex)

interface Data {
    [key: string]: any;
}

export default new Vuex.Store<Data>({
    plugins: [createPersistedState()],
    state: {
        pinyinInput: false,
        token: null,
    },
    mutations: {
        pinyinInput_Toggle(state) {
            state.pinyinInput = !state.pinyinInput;
        },
        pinyinInput(state, data) {
            state.pinyinInput = data;
        },
        token(state, data) {
            state.token = data;
        },
    },
    actions: {
    },
    modules: {
    },
    getters: {
        pinyinInput(state) {
            return state.pinyinInput;
        },
        token(state) {
            return state.token;
        },
    }
})

// declare module "vue/types/vue" {
//     interface Vue {
//         $store: Store<Data>;
//     }
// }
